#ifndef _ROB_RC_C
#define _ROB_RC_H

#include <WProgram.h>
#include <avr/io.h>

// protocol

#define RCCMD_IR_REMOTE_BTN 0x01
// ...
// ...
// ...


// IR Remote control command buttons
#define IR_REMOTE_BTN_NONE 0x00
#define IR_REMOTE_BTN_UP 0x01
#define IR_REMOTE_BTN_DN 0x02
#define IR_REMOTE_BTN_LE 0x03
#define IR_REMOTE_BTN_RE 0x04
#define IR_REMOTE_BTN_CC 0x05
#define IR_REMOTE_BTN_MM 0x06


#define REMOTE_MOTOR_SPEED 0x80 // Speed to use when controlling via IR remote
#define SERVO_STEP 20 // Speed to use when controlling via IR remote

#define IR_CONTROL_MAX_IDLE_CYCLES 16


class CRC {
public:
  void Begin(void);
  void message(uint8_t cmd, uint8_t code);
  void update(void);

private:
  uint8_t _IRcycles;
  uint8_t _lastIRRemoteCmd;
  void handleIRRemoteBtnMM(void);
};

extern CRC RC;






#endif //_ROB_RC_H

